package com.friend.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p></p>
 *
 * @author jiuhua.xu
 * @version 1.0
 * @since JDK 1.8
 */
@RestController
public class HelloController {

    @GetMapping("hello")
    @PreAuthorize("hasRole('ADMIN')")
    public String hello() {
        return "hello spring security. has role admin";
    }

    @GetMapping("other")
    @PreAuthorize("hasRole('OTHER')")
    public String other() {
        return "hello spring security. has role other";
    }
}
